<%@ page pageEncoding="UTF-8"%>
<%@ include file="../commons/head.jsp"%>
<style type="text/css">
	.button{width: 100px;height: 30px;margin:3px 20px 3px 0;padding-top: 3px;}
	*{font-size: 14px;}
	.th td{font-weight: 700;}
	/* label{margin: 0 10px 0 18px;font-weight: 500;height: 25px;line-height: 25px;} */
     .control-label{padding: 0;font-weight: bold;}
     .diaform{margin: 20px auto;}
     h3{border-bottom:1px solid #ddd;padding-bottom:5px;width: 98%;  }
     .datagrid-view{border-top:1px solid #ddd;margin-top: 8px;}
     .datagrid-pager{border-bottom:1px solid #ccc;}
     hr{margin:15px 0 13px 0 ;background-color: #ddd;height: 1px;border: 0; width: 120%;}
     .jianju{margin-left:15px; }
     .datagrid-htable{
     font-weight:bold;
	/* background-color: #148CCA; */
	}
	.demo_line_01{
    
    margin: 5px 0;
    font-size: 50px;
    line-height: 1px;
    text-align: center;
	}
	.demo_line_01 .line{
	display:inline-block;
	   width:47.8%;
	   height:1px;
	   background:#ddd;
	   vertical-align:middle;
	   margin-top:8px;
	}
	.container-fluid{
	padding-left: 15px;
	}
	.datagrid-ftable td div{
		font-size: larger;
	
	}
	#pulldown{
		margin-top: 20px;
	}
	
/* td.datagrid-header-over{
	background: #148CCA !important;
} */
</style>
<title>今日应收</title>
<style type="text/css">
.datagrid-ftable {
	color: red;
	font-weight: bold;
}
.datagrid-body {
height:300px !important;
}
.datagrid-view {
height:360px !important;
}

</style>
<script src="${ctxStatic}/js/echarts.js"></script>
</head>
<body>
<div class="jianju">
<h3>今日应收</h3>

<div>
	<div class="row">
		<div class="form-inline">
			&nbsp;&nbsp;&nbsp;
			<div class="input-group">
				<span class="input-group-addon">客户姓名</span>
				<input id=customerName class="form-control">
			</div>
			<div class="input-group">
				<span class="input-group-addon">客户手机</span>
				<input id=customerPhone class="form-control">
			</div>
		</div>
	</div>
	<div class="row">
		<div class="form-inline">
			&nbsp;&nbsp;&nbsp;
			<div class="input-group">
				<span class="input-group-addon" >推荐人&nbsp;&nbsp;&nbsp;</span>
				<input id=recom class="form-control" >
			</div>
			<div class="input-group">
				<span class="input-group-addon">所属公司</span>
				<select style="height:34px;width:180px" id="companyName" class="easyui-combobox" mode="remote"
					url="${ctx}/todayMoney/companyName"
					valueField="id" textField="contactName" method="get" editable="false"
					panelHeight="auto">
				</select>
			</div>
			<div class="input-group">
				<input id="select" type="button" class="btn btn-primary" value="查询">
			</div>
		</div>
	</div>
</div>

<table id="tabid" class="table table-striped">
	<thead>
		<tr id="ttr">
			<th></th>
			<th>合同编号</th>
			<th>用户姓名</th>
			<th>所属公司</th>
			<th>联系电话</th>
			<th>拟借金额</th>
			<th>申请日期</th>
			<th>服务期数</th>
			<th>合同状态</th>
			<th>操作</th>
		</tr>
	</thead>
	<tbody>
            <c:forEach items="${list}" var="u"  varStatus="uid">>
                <tr>
                	<td>
                            ${uid.count}
                    </td>
                    <td>
                            ${u.id}
                    </td>
                    <td>
                            ${u.customerName}
                    </td>
                    <td>
                            ${u.orgName}
                    </td>
                    <td>
                            ${u.customerPhone}
                    </td>
                    <td>
                            ${u.exoAmount}
                    </td>
                    <td>
                            ${u.appDateStr}
                    </td>
                    <td>
                            ${u.approvalCyc}
                    </td>
                    <td>
                    		${u.statusStr}
                    </td>
                    <td>
                    		<a href="#">执行详情</a>
                    </td>
               	</tr>
             </c:forEach>
         </tbody>   
</table>
<div style="margin-bottom:5px">
	<a id="export" href="#" class="easyui-linkbutton button" iconCls="icon-daochu">导出</a>
</div>
</body>
<script>
	//导出
	$("#export").click(function(){
		window.location.href="${ctx}/todayMoney/export?customerName="+ $("#customerName").val()+"&customerPhone="+$("#customerPhone").val()+"&recom="+$("#recom").val()+"&id="+$("#companyName").combobox("getValue")
	})
	$(function(){
		//设置下拉框默认选中"全部"
		$('#companyName').combobox({onLoadSuccess:function(){
			var data = $('#companyName').combobox('getData');
			if(data){
	 			$("#companyName").combobox('select',data[0].userAccount);
			}
		}
		})
	})
	$(function() {
		$("#select").click(
				function() {
					$.ajax({
						url:"${ctx}/todayMoney/find?customerName="+ $("#customerName").val()+"&customerPhone="+$("#customerPhone").val()+"&recom="+$("#recom").val()+"&id="+$("#companyName").combobox("getValue"),
						contentType: "application/json; charset=utf-8",
						method:'get',
						data:"",
						success:function(data){
							var list=data;
							var snapinfo_table = document.getElementById("tabid");  
						    var snapinfo_tr_num = snapinfo_table.rows.length;  
						    for(var i=snapinfo_tr_num-1;i>0;i--){  
						             snapinfo_table.deleteRow(i);  
						    }  
							for(var i=0;i<list.length;i++){
								var tr=document.createElement("tr");
							   	var td1=document.createElement("td");
							   	td1.innerHTML=i+1;
							   	var td2=document.createElement("td");
							   	td2.innerHTML=list[i].id
							   	var td3=document.createElement("td");
							   	td3.innerHTML=list[i].customerName
							   	var td4=document.createElement("td");
							   	td4.innerHTML=list[i].orgName
							   	var td5=document.createElement("td");
							   	td5.innerHTML=list[i].customerPhone
							   	var td6=document.createElement("td");
							   	td6.innerHTML=list[i].exoAmount
							   	var td7=document.createElement("td");
							   	td7.innerHTML=list[i].appDateStr
							   	var td8=document.createElement("td");
							   	td8.innerHTML=list[i].approvalCyc
							   	var td9=document.createElement("td");
							   	td9.innerHTML=list[i].statusStr
							   	var td10=document.createElement("td");
							   	td10.innerHTML="<a>执行详情</a>";
							   	td9.firstChild.href='#'
							   	tr.appendChild(td1);
							   	tr.appendChild(td2);
							   	tr.appendChild(td3);
							   	tr.appendChild(td4);
							   	tr.appendChild(td5);
							   	tr.appendChild(td6);
							   	tr.appendChild(td7);
							   	tr.appendChild(td8);
							   	tr.appendChild(td9);
							   	tr.appendChild(td10);
							   	$("table").append(tr);
							}
						}
						
					})
				})
	})
	$(function(){
		$("#add").click(function(){
			location.href="${ctx}/selectRole/add?roleName="+$("#roleName").val()
		})
	})
</script>
</html>